package com.chinacoal.microservice.controller;

import com.chinacoal.microservice.MaintenanceRecordsClient;
import com.chinacoal.microservice.pojo.CcmsSmartleasingRepair;
import com.chinacoal.microservice.service.MaintenanceRecordsService;
import com.chinacoal.microservice.util.PassToken;
import com.chinacoal.microservice.util.QueryCriteria;
import com.chinacoal.microservice.util.Result;
import com.chinacoal.microservice.util.UserLoginToken;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author zhuliang
 * @version V1.0
 * @Description: 房源管理-维修记录-后台控制类
 * @date 2020-11-10 13：57
 */
@RestController
public class MaintenanceRecordsController implements MaintenanceRecordsClient {

    @Autowired
    private MaintenanceRecordsService maintenanceRecordsService;

    /**
     * @Description: 查询所有的维修记录（带分页）
     * @author zhuliang
     * @date 2020/11/10 13:58
     */
    @Override
    @UserLoginToken
    public Result<List<CcmsSmartleasingRepair>> getMaintenanceRecords(QueryCriteria queryCriteria, String token) {
        return maintenanceRecordsService.getMaintenanceRecords(queryCriteria, token);
    }

    /**
     * @Description: 根据维修信息id查询对应的信息
     * @author zhuliang
     * @date 2020/11/10 14:19
     */
    @Override
    @UserLoginToken
    public Result<CcmsSmartleasingRepair> getMaintenanceById(String pkRepairId, String token) {
        return maintenanceRecordsService.getMaintenanceById(pkRepairId, token);
    }

    /**
     * @Description: 添加维修信息
     * @author zhuliang
     * @date 2020/11/10 14:29
     */
    @Override
    @UserLoginToken
    public Result addMaintenanceRecords(CcmsSmartleasingRepair repair, String token) {
        return maintenanceRecordsService.addMaintenanceRecords(repair, token);
    }

    /**
     * @Description: 修改维修信息
     * @author zhuliang
     * @date 2020/11/10 14:37
     */
    @Override
    @UserLoginToken
    public Result updateMaintenanceRecords(CcmsSmartleasingRepair repair, String token) {
        return maintenanceRecordsService.updateMaintenanceRecords(repair, token);
    }

    /**
     * @Description: 根据维修信息id删除对应的维修信息
     * @author zhuliang
     * @date 2020/11/10 14:42
     */
    @Override
    @UserLoginToken
    public Result delectMaintenanceRecords(String deleteId, String token) {
        return maintenanceRecordsService.delectMaintenanceRecords(deleteId, token);
    }

    /**
     * @Description: 条件查询维修信息（带分页）
     * @author zhuliang
     * @date 2020/11/10 16:07
     */
    @Override
    @UserLoginToken
    public Result<List<CcmsSmartleasingRepair>> queryMaintenanceRecords(QueryCriteria queryCriteria, String token) {
        return maintenanceRecordsService.queryMaintenanceRecords(queryCriteria, token);
    }


}
